<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use App\Services\Response;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    protected function success($data, $msg='success'){
        return Response::apiSuccess($data, $msg);
    }

    /**
     * @apiDefine PublicCommonParams
     * @apiSuccess {integer} code 状态码
     * @apiSuccess {Object} data 响应数据
     * @apiSuccess {string} msg 响应结果
     * @apiError {string} msg 错误信息
     */

    /**
     * @apiDefine CommonParams
     * @apiParam {string} token 用户身份令牌
     * @apiUse CommonParams
     */

    /**
     * @apiDefine ErrorToken
     * @apiErrorExample {json} token异常示例
     * {"code":202,"msg":"TOKEN已失效","data":null}
     */

    /**
     * @apiDefine SignBlock
     * @apiParam {string} sign 数据签名
     * @apiParam {integer} timestamp UNIX时间戳 毫秒 13位数整数
     */

    /**
     * @apiDefine CommonBlock
     * @apiUse CommonParams
     * @apiUse ErrorToken
     */

    /**
     * @apiDefine PublicCommonBlock
     * @apiUse PublicCommonParams
     * @apiUse ErrorToken
     */

}
